﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Newtonsoft.Json;

namespace FizzDevelop
{
	public class FizzProject
	{
		public string DisplayName;
		public string Path;
		public List<FizzFile> Files;
		
		public FizzProject(string name, string path)
		{
			DisplayName = name;
			Path = path + "\\" + DisplayName;
			Files = new List<FizzFile>();
		}

		public void Create()
		{
			Directory.CreateDirectory(Path);
			File.WriteAllText(Path + "\\fizzproject.json", JsonConvert.SerializeObject(this, Formatting.Indented));
		}

		public override bool Equals(object obj)
		{
			FizzProject project;
			if (obj.GetType() == typeof(FizzProject))
			{
				project = (FizzProject)obj;
				return ((project.DisplayName == this.DisplayName) && (project.Path == this.Path));
			}
			else
				return false;
		}

		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

		public override string ToString()
		{
			return DisplayName;
		}
	}
}
